<!DOCTYPE HTML>
<html>
<head>
  <script type="text/javascript" src="../extension/third_party/closure/base.js"></script>
  <script type="text/javascript" src="../extension/utils.js"></script>
  <script type="text/javascript" src="../extension/secure_prober.js"></script>
  <script type="text/javascript" src="../extension/background.js"></script>
  <script type="text/javascript">
  goog.require('goog.testing.AsyncTestCase');
  goog.require('goog.testing.jsunit');
  goog.require('secureSites.SecureProber');
  </script>
</head>
<body>
  <script type="text/javascript">
  var asyncTestCase = goog.testing.AsyncTestCase.createAndInstall();
  
  function assertSecureVersionFound(object) {
    assertEquals(200, object.statusCode);
    asyncTestCase.continueTesting();
  }
  
  function assertSecureVersionNotFound(object) {
    assertNotEquals(200, object.statusCode);
    asyncTestCase.continueTesting();
  }
  
  function testCanFindSecureVersionOfTwitterWhich200s() {
    new secureSites.SecureProber().probe("https://twitter.com", assertSecureVersionFound);
    
    asyncTestCase.waitForAsync('Waiting for prober on twitter');
  }
  
  function testCanFindSecureVersionOfGoogleWhich302sToAnotherDomain() {
    new secureSites.SecureProber().probe("https://google.com", assertSecureVersionFound);
    
    asyncTestCase.waitForAsync('Waiting for prober on google');
  }
  
  function testCannotFindSecureVersionOfBbcWhich301sToInsecure() {
    new secureSites.SecureProber().probe("https://www.bbc.co.uk", assertSecureVersionNotFound);
    
    asyncTestCase.waitForAsync('Waiting for prober on bbc');
  }
  </script>
</body>
</html>